package com.cy.pj.controller;

import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
public class JQueryAjaxController {
    @PostMapping("doPostJson")
    public String doPostJson(@RequestBody Map<String,Object> map){
        System.out.println("map="+map);
        return "post ok";
    }

    @PostMapping("doPost")
    public String doPost(@RequestParam Map<String,Object> map){
        System.out.println("map="+map);
        return "post ok";
    }

    @GetMapping("doGet")
    public Map<String,Object> doGet(){
        Map<String,Object> map=new HashMap<>();
        map.put("code",100);
        map.put("message","success");
        return map;
    }

    @RequestMapping("doAjax")
    public String doAjax(String msg){
        System.out.println("msg="+msg);
        return msg+".toUpperCase():"+msg.toUpperCase();
    }
}
